<template>
  <div class="home-layout">
    <el-container>
      <!-- 左侧导航栏 -->
      <el-aside :width="isCollapse ? '64px' : '275px'" class="custom-aside">
        <Aside :isCollapse="isCollapse" />
      </el-aside>

      <!-- 右侧内容区域 -->
      <el-container>
        <!-- 顶部导航栏 -->
        <el-header class="custom-header">
          <Header :isCollapse="isCollapse" @toggle-collapse="toggleCollapse" />
        </el-header>

        <!-- 主体部分 -->
        <el-main>
          <router-view />
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import Header from '@/views/home/components/Header.vue'
import Aside from '@/views/home/components/Aside.vue'

const isCollapse = ref(false)

const toggleCollapse = () => {
  isCollapse.value = !isCollapse.value
}
</script>

<style scoped lang="less">
.home-layout {
  height: 100vh;
  display: flex;
}

.custom-aside {
  background-color: #304156;
  transition: width 0.3s;
  height: 100vh;
  overflow: hidden;
}

.custom-header {
  background-color: #5b6d85;
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 20px;
  height: 64px;
}

.el-main {
  padding: 20px;
  background-color: #f0f2f5;
  height: calc(100vh - 64px);
  overflow: auto;
}
</style>
